<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>elicpse配置 | 月藤的博客</title>
    <meta name="generator" content="VuePress 1.8.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.10.0/github-markdown.min.css">
    <meta name="description" content="简单的介绍">
    
    <link rel="preload" href="/assets/css/0.styles.a2e941e0.css" as="style"><link rel="preload" href="/assets/js/app.c7d9ff18.js" as="script"><link rel="preload" href="/assets/js/2.cd56dec9.js" as="script"><link rel="preload" href="/assets/js/9.a86daf82.js" as="script"><link rel="prefetch" href="/assets/js/10.21f484f8.js"><link rel="prefetch" href="/assets/js/11.5e166696.js"><link rel="prefetch" href="/assets/js/12.c56c19a2.js"><link rel="prefetch" href="/assets/js/13.3e31b609.js"><link rel="prefetch" href="/assets/js/14.3db3e5e6.js"><link rel="prefetch" href="/assets/js/15.cc75d7c3.js"><link rel="prefetch" href="/assets/js/16.5546d343.js"><link rel="prefetch" href="/assets/js/17.69b8a0f2.js"><link rel="prefetch" href="/assets/js/18.271396c8.js"><link rel="prefetch" href="/assets/js/19.bd4b0386.js"><link rel="prefetch" href="/assets/js/20.4a48d936.js"><link rel="prefetch" href="/assets/js/21.23862f34.js"><link rel="prefetch" href="/assets/js/22.95b3bd0a.js"><link rel="prefetch" href="/assets/js/23.d7c85d8e.js"><link rel="prefetch" href="/assets/js/24.c6d6dd3c.js"><link rel="prefetch" href="/assets/js/25.bb664de8.js"><link rel="prefetch" href="/assets/js/26.619789c7.js"><link rel="prefetch" href="/assets/js/27.54beb19d.js"><link rel="prefetch" href="/assets/js/28.8d77923a.js"><link rel="prefetch" href="/assets/js/29.7a771891.js"><link rel="prefetch" href="/assets/js/3.a0dd59cc.js"><link rel="prefetch" href="/assets/js/30.73e03cd7.js"><link rel="prefetch" href="/assets/js/31.a9a1ae37.js"><link rel="prefetch" href="/assets/js/32.66082a76.js"><link rel="prefetch" href="/assets/js/33.73a91496.js"><link rel="prefetch" href="/assets/js/34.da867ae2.js"><link rel="prefetch" href="/assets/js/35.6fac5ae2.js"><link rel="prefetch" href="/assets/js/36.0d6f5d22.js"><link rel="prefetch" href="/assets/js/37.c16a4955.js"><link rel="prefetch" href="/assets/js/38.3391e103.js"><link rel="prefetch" href="/assets/js/39.2e00541f.js"><link rel="prefetch" href="/assets/js/4.7f4b5eea.js"><link rel="prefetch" href="/assets/js/40.22b54e67.js"><link rel="prefetch" href="/assets/js/41.ea3ea4f8.js"><link rel="prefetch" href="/assets/js/42.3ae1db24.js"><link rel="prefetch" href="/assets/js/43.ecd8c202.js"><link rel="prefetch" href="/assets/js/44.f7609015.js"><link rel="prefetch" href="/assets/js/45.0db6f0b1.js"><link rel="prefetch" href="/assets/js/46.e28c1031.js"><link rel="prefetch" href="/assets/js/47.32d7164d.js"><link rel="prefetch" href="/assets/js/48.3aeaffda.js"><link rel="prefetch" href="/assets/js/49.33dab1c0.js"><link rel="prefetch" href="/assets/js/5.80c2b38b.js"><link rel="prefetch" href="/assets/js/50.6e41bca8.js"><link rel="prefetch" href="/assets/js/51.37e89a7c.js"><link rel="prefetch" href="/assets/js/52.e60e1d45.js"><link rel="prefetch" href="/assets/js/53.7a9c00ba.js"><link rel="prefetch" href="/assets/js/54.a214a30e.js"><link rel="prefetch" href="/assets/js/6.133fd621.js"><link rel="prefetch" href="/assets/js/7.79403511.js"><link rel="prefetch" href="/assets/js/8.04726c3a.js">
    <link rel="stylesheet" href="/assets/css/0.styles.a2e941e0.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">月藤的博客</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="https://ziphold.gitee.io/blog/#/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  旧博客（停止更新）
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="https://rattonlzh.github.io/homepage/homepage.html" target="_blank" rel="noopener noreferrer" class="nav-link external">
  常用网址导航（停止更新）
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Select language" class="dropdown-title"><span class="title">Languages</span> <span class="arrow down"></span></button> <button type="button" aria-label="Select language" class="mobile-dropdown-title"><span class="title">Languages</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/配置记录/elicpse配置.html" class="nav-link">
  zh-CN
</a></li><li class="dropdown-item"><!----> <a href="/en/" class="nav-link">
  en-US
</a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><div class="avatar"><img src="/assets/img/avatar.2b77755b.png" alt srcset></div> <div style="z-index: 999"><iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width="298" height="52" src="//music.163.com/outchain/player?type=2&id=28283137&auto=1&height=32"></iframe></div> <nav class="nav-links"><div class="nav-item"><a href="https://ziphold.gitee.io/blog/#/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  旧博客（停止更新）
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="https://rattonlzh.github.io/homepage/homepage.html" target="_blank" rel="noopener noreferrer" class="nav-link external">
  常用网址导航（停止更新）
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Select language" class="dropdown-title"><span class="title">Languages</span> <span class="arrow down"></span></button> <button type="button" aria-label="Select language" class="mobile-dropdown-title"><span class="title">Languages</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/配置记录/elicpse配置.html" class="nav-link">
  zh-CN
</a></li><li class="dropdown-item"><!----> <a href="/en/" class="nav-link">
  en-US
</a></li></ul></div></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>随便说说</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>知识点总结</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>考研专区</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>读书笔记</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>开发资料</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>配置记录</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/配置记录/apache服务器配置.html" class="sidebar-link">apache服务器配置</a></li><li><a href="/配置记录/elicpse配置.html" class="active sidebar-link">elicpse配置</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/配置记录/elicpse配置.html#设置字符集编码" class="sidebar-link">设置字符集编码</a></li><li class="sidebar-sub-header"><a href="/配置记录/elicpse配置.html#添加jre以及新建工程" class="sidebar-link">添加jre以及新建工程</a></li><li class="sidebar-sub-header"><a href="/配置记录/elicpse配置.html#智能提示" class="sidebar-link">智能提示</a></li><li class="sidebar-sub-header"><a href="/配置记录/elicpse配置.html#绑定src-zip" class="sidebar-link">绑定src.zip</a></li><li class="sidebar-sub-header"><a href="/配置记录/elicpse配置.html#修改快捷键" class="sidebar-link">修改快捷键</a></li><li class="sidebar-sub-header"><a href="/配置记录/elicpse配置.html#常用快捷键" class="sidebar-link">常用快捷键</a></li><li class="sidebar-sub-header"><a href="/配置记录/elicpse配置.html#常用代码片段-snippet" class="sidebar-link">常用代码片段(snippet)</a></li></ul></li><li><a href="/配置记录/install-sogou-im.html" class="sidebar-link">ubuntu18.04下安装搜狗输入法</a></li><li><a href="/配置记录/LAMP安装记.html" class="sidebar-link">LAMP实训</a></li><li><a href="/配置记录/lnmp安装.html" class="sidebar-link">一条命令开启lnmp</a></li><li><a href="/配置记录/Ubuntu１８．０４新手踩雷.html" class="sidebar-link">ubuntu18.04 新手踩雷</a></li><li><a href="/配置记录/安装linux虚拟机.html" class="sidebar-link">安装linux实验环境</a></li><li><a href="/配置记录/运行tensorflow使用gpu加速.html" class="sidebar-link">运行tensorflow使用gpu加速</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>思维导图</span> <span class="arrow right"></span></p> <!----></section></li><li><a href="/friend_link.html" class="sidebar-link">友情链接</a></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="elicpse配置"><a href="#elicpse配置" class="header-anchor">#</a> elicpse配置</h1> <p><img src="/assets/img/1580029077718.71e34568.png" alt="1580029077718"></p> <h2 id="设置字符集编码"><a href="#设置字符集编码" class="header-anchor">#</a> 设置字符集编码</h2> <p>我打开eclipse，发现win10下默认编码居然是gbk编码的，如今utf8才是最通用的编码集，能用utf8就用utf8吧</p> <p>首先打开Preferences</p> <p><img src="/assets/img/1580025968432.ccca975e.png" alt="1580025968432"></p> <p>键入encoding关键词，在workspace中找到text file encoding，选择other&gt;UTF-8,点击Apply或者Ok确定</p> <p><img src="/assets/img/1580026000278.f8977aea.png" alt="1580026000278"></p> <h2 id="添加jre以及新建工程"><a href="#添加jre以及新建工程" class="header-anchor">#</a> 添加jre以及新建工程</h2> <p><code>alt+shift+N</code>新建java project</p> <p><img src="/assets/img/1580026307578.f2eefd65.png" alt="1580026307578"></p> <p>点击Configure JREs</p> <p><img src="/assets/img/1580026342372.4afa39c1.png" alt="1580026342372"></p> <p>点击Add添加</p> <p><img src="/assets/img/1580026382593.3f8afde8.png" alt="1580026382593"></p> <p>选择Standard VM</p> <p><img src="/assets/img/1580026396207.4d15da80.png" alt="1580026396207"></p> <p>选择jdk目录(该目录包含jre),正确配置路径后,JRE system libraries会显示一系列的jar包,点击finish</p> <p><img src="/assets/img/1580026464186.b0cf6e93.png" alt="1580026464186"></p> <p>现在可以在 <code>Use a project specific JRE</code>可以选择刚才添加的jre了,点击finish完成新项目的创建</p> <p><img src="/assets/img/1580026525812.e94380c4.png" alt="1580026525812"></p> <p>在preferencs 中输入compiler关键词,点击Compiler, Compiler compliance level中选择你需要的版本,确保可以使用该版本的特性.</p> <p><img src="/assets/img/1580027211807.0799f16a.png" alt="1580027211807"></p> <h2 id="智能提示"><a href="#智能提示" class="header-anchor">#</a> 智能提示</h2> <p>默认状态下输入<code>.</code>时才会出现语法提示,现在改为输入<code>.</code>和字母都可以出现代码提示. 在preferences输入assist, 点开content assist, 确保 <code>Enable auto activation</code>, <code>Auto activation triggers for Java</code>输入<code>.qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM</code>,确定更改</p> <p><img src="/assets/img/1580026768208.20272a79.png" alt="1580026768208"></p> <h2 id="绑定src-zip"><a href="#绑定src-zip" class="header-anchor">#</a> 绑定src.zip</h2> <p>为了更好的学习java和提高开发效率, 我们希望点击java内置类的类名,可以跳转到类的定义查看详情, 这需要保证我们的<code>rt.jar</code>绑定<code>src.zip</code>. 如果<code>ctrl</code>+鼠标左击类名提示Source not found, 说明没有绑定<code>src.zip</code>,此时点击Attach Source按钮绑定即可,注意添加的是<code>src.zip</code>文件,</p> <p><img src="/assets/img/1580031437150.059f3977.png" alt="1580031437150"></p> <p>如果要手动更改绑定的src.zip文件, 在Installed JREs选择项目对应版本的jre,点击Edit</p> <p><img src="/assets/img/1580031532446.44a38eff.png" alt="1580031532446"></p> <p>在JRE system libraries中选中<code>rt.jar</code>,点击<code>Source Attachment</code></p> <p><img src="/assets/img/1580028681289.7db8699c.png" alt="1580028681289"></p> <p>配置src.zip路径</p> <p><img src="/assets/img/1580029021027.d8db61a5.png" alt="1580029021027"></p> <h2 id="修改快捷键"><a href="#修改快捷键" class="header-anchor">#</a> 修改快捷键</h2> <p>我们需要更改快捷键以提高开发效率, 在preferences中输入bind,选中keys,在右边的搜索框中输入indentation,选中Correct Indentation,取消该快捷键绑定,因为这个功能可以用<code>Ctrl + Shift+F</code>代码格式化实现, 用处不大, 我将它原有的<code>Ctrl+I</code>快捷键绑定到<code>Override/Implement Method</code>上,这个可以给类添加可以覆盖的方法,非常实用.</p> <p><img src="/assets/img/1580029152547.7db89dc4.png" alt="1580029152547"></p> <p>给<code>Override/Implement Method from super types</code>添加Binding为<code>Ctrl+I</code>,when设置为<code>Editing Text</code>时生效,保存更改.</p> <p><img src="/assets/img/1580029729986.ab3c8902.png" alt="1580029729986"></p> <h2 id="常用快捷键"><a href="#常用快捷键" class="header-anchor">#</a> 常用快捷键</h2> <ul><li><p><code>/** + enter</code>: 在方法头新建javadoc注释</p></li> <li><p><code>alt + shift + q, p</code>: 打开package explorer视图</p></li> <li><p><code>Ctrl+Shift+L</code>打开快捷键帮助列表</p></li> <li><p><code>Ctrl+Shift+O</code>导入缺失的包或删除未使用的包</p></li> <li><p><code>Ctrl+/</code>行注释/取消注释</p></li> <li><p><code>ctrl+shift+f</code>: 格式化代码</p></li> <li><p><code>Ctrl+I</code>:(自定义快捷键)重写父类的方法</p></li> <li><p><code>f11</code>:debug</p></li> <li><p><code>Ctrl+f11</code>:run</p></li> <li><p><code>Ctrl+1</code>:修正错误</p></li> <li><p><code>ctrl+d</code>: 删除当前行</p></li> <li><p><code>shift+enter</code>:光标移到下面的新行</p></li> <li><p><code>Ctrl+shift+enter</code>: 光标移到上面的新行</p></li> <li><p><code>ctrl+shift+r</code>: 打开项目文件</p></li> <li><p><code>alt+/</code>: 代码补全</p></li> <li><p><code>alt+方向键up或down</code>: 移动当前行</p></li> <li><p><code>ctrl+alt+方向键down</code>: 复制当前行到下一行</p></li></ul> <h2 id="常用代码片段-snippet"><a href="#常用代码片段-snippet" class="header-anchor">#</a> 常用代码片段(snippet)</h2> <ul><li><p>sysout:<code>System.out.println</code></p></li> <li><p>syserr:<code>System.err.println</code></p></li> <li><p>main:<code>public static void main(String[] args)</code></p></li></ul> <h1 id="linux下使用eclipse"><a href="#linux下使用eclipse" class="header-anchor">#</a> Linux下使用Eclipse</h1> <p>eclipse在win10和linux下的默认选项有点不同</p> <table><thead><tr><th style="text-align:left;">选项</th> <th>win10</th> <th>ubuntu</th></tr></thead> <tbody><tr><td style="text-align:left;">文件编码</td> <td>gbk</td> <td>utf-8</td></tr> <tr><td style="text-align:left;">代码片段补全</td> <td>alt+/或ctrl+space</td> <td>ctrl+space</td></tr></tbody></table></div> <footer class="page-edit"><!----> <!----> <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh"><img alt="知识共享许可协议" src="" style="border-width:0"></a><br>本作品采用<a rel="license" href="http://creativecommons.org/licenses/by/4.0/">知识共享署名 4.0 国际许可协议</a>进行许可。

   
</footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/配置记录/apache服务器配置.html" class="prev">
        apache服务器配置
      </a></span> <span class="next"><a href="/配置记录/install-sogou-im.html">
        ubuntu18.04下安装搜狗输入法
      </a>
      →
    </span></p></div>  <footer style="text-align:center;">备案号： 粤ICP备2021020303号</footer></main></div><div class="global-ui"><!----></div></div>
    <script src="/assets/js/app.c7d9ff18.js" defer></script><script src="/assets/js/2.cd56dec9.js" defer></script><script src="/assets/js/9.a86daf82.js" defer></script>
  </body>
</html>
